package com.aaa.inside.mapper;

import com.aaa.entity.inside.Move;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author aaa
 * @since 2020-11-27
 */
public interface MoveMapper extends BaseMapper<Move> {
    @Select("select distinct bc.name,bc.bar from b_commodity bc join b_stock bs on bc.id=bs.commodityid\n" +
            "join b_locator bl on bs.locatorid=bl.id\n" +
            "where bs.warehouseid=#{warehouseid} and bs.uqty>0")
    List<Map> selectComByWareId(Long warehouseid);
    @Select("select bs.locatorcode,bs.locatorname,bs.uqty from b_commodity bc join b_stock bs on bc.id=bs.commodityid\n" +
            "join b_locator bl on bs.locatorid=bl.id\n" +
            "where bs.warehouseid=#{warehouseid} and commoditybar=#{commoditybar} and bs.uqty>0")
    List<Map> selectOriLocByCombar(String commoditybar, Long warehouseid);
    @Select("select bl.name,bl.code from b_locator bl where bl.type=(select type from b_locator where code=#{oldlocatorcode}) and warehouseid=#{warehouseid} and bl.code!=#{oldlocatorcode}")
    List<Map> selectTarLocByOrLoc(String oldlocatorcode,Long warehouseid);
}
